local GuildWarScheduleTitleCell = app.mvc.createListViewCell(...)
local CrossServerGuildWarHelper = require("app.crossServer.views.guildWar.CrossServerGuildWarHelper")
--data =
function GuildWarScheduleTitleCell.create(node)
    local sprite = GuildWarScheduleTitleCell.extend(node or cc.CSLoader:createNode(Res.CSGuildWarScheduleTitleCell))
    if node == nil then
        ccui.Helper:doLayout(sprite)
    end
    sprite:init()
    return sprite
end


function GuildWarScheduleTitleCell:init(data)
    self.super.init(self, data)
    self:setContentSize( self._ui.Panel:getContentSize() )
    self:refresh()

end

function GuildWarScheduleTitleCell:refresh()
    if not self._data then
        return
    end
    local round = self._data.round
    if round ~= nil then
        local wDay = app:getWeekDayPassDailyUpdate()
        if wDay == 6 then
            -- 决赛
            local stageStr = ""
            if round == 0 then
                stageStr =  L("finialsStage1to4")--string.format(L("CSGuildWarAwardTitle"), 1, 4)
            elseif round == 1 then
                stageStr =  L("finialsStage5to8") --string.format(L("CSGuildWarAwardTitle"), 5, 8)
            elseif round == 2 then
                stageStr =  L("finialsStage9to12") --string.format(L("CSGuildWarAwardTitle"), 9, 12)
            elseif round == 3 then
                stageStr =  L("finialsStage13to16") --string.format(L("CSGuildWarAwardTitle"), 13, 16)
            end
            self._ui.tlt:setString(L("lua_code_text_270").."  " .. stageStr)
        elseif wDay == 7 then
            local stageStr = ""
            if round == 0 then
                stageStr = L("finialsStage1to2")
            elseif round == 1 then
                stageStr = L("finialsStage3to4")
            elseif round == 2 then
                stageStr = L("finialsStage5to6")
            elseif round == 3 then
                stageStr = L("finialsStage7to8")
            elseif round == 4 then
                stageStr = L("finialsStage9to10")
            elseif round == 5 then
                stageStr = L("finialsStage11to12")
            elseif round == 6 then
                stageStr = L("finialsStage13to14")
            elseif round == 7 then
                stageStr = L("finialsStage15to16")
            end
            self._ui.tlt:setString(L("lua_code_text_270").."  " .. stageStr)
        else
            self._ui.tlt:setString(L("regularStage") .."  ".. string.format(L("CSGuildWarRoundStr"), round))
        end
    end
end


return GuildWarScheduleTitleCell